package com.hai.test.ui;

import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import com.hai.test.R;

public class SubActivity extends AppCompatActivity {
    private static final String TAG = "SubActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sub);
        setTitle("subActivity");


    }

    @Override
    protected void onResume() {
        super.onResume();
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        int width = displayMetrics.widthPixels;
        int height = displayMetrics.heightPixels;
        Log.e(TAG, "onResume: width=" + width + ",height=" + height);
        View viewById = findViewById(R.id.ll);
        viewById.postDelayed(new Runnable() {
            @Override
            public void run() {
                int width = viewById.getWidth();
                int height = viewById.getHeight();
                Log.e(TAG, "onResume: width=" + width + ",height=" + height);

                View viewById = findViewById(R.id.sl);
                width = viewById.getWidth();
                height = viewById.getHeight();
                Log.e(TAG, "onResume: width=" + width + ",height=" + height);

            }
        }, 1000);

    }

    public void clk(View view) {
        int id = view.getId();
        switch (id) {
            case R.id.btn2:
//                Process.killProcess(Process.myPid());
                System.exit(0);
                break;
            default:
                finish();
                break;
        }

    }
}
